home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d4 / larn12a.arc / NANSI.DOC < prev    next >
Text File  |  1986-11-05  |  7KB  |  164 lines

  1. SYNOPSIS
  2.     Include in \config.sys the line
  3.         device=nansi.sys
  4.  
  5. DESCRIPTION
  6.     Nansi.sys is a console driver which understands ANSI control
  7.     sequences. It has several advantages over ANSI.SYS (the driver
  8.     supplied with DOS):
  9.     1. It supports new escape sequences (see below).
  10.     2. It provides MUCH faster output under certain conditions.
  11.     3. It supports the 43-line mode of the EGA.
  12.     4. The darned bell is now 1/4 second instead of 1/2 second long.
  13.  
  14.     What a console driver does:
  15.     When you, for example, type
  16.         C:> type foo.txt
  17.     COMMAND.COM opens the file foo.txt, reads it, and writes it to
  18.     the console driver, which puts it up on the screen.
  19.  
  20.     Both ansi.sys and nansi.sys use IBM Video BIOS to control the screen.
  21.     However, nansi.sys bypasses BIOS if the screen is in a text mode; this
  22.     allows much faster operation under certain conditions.
  23.  
  24.     While putting text up on the screen, (n)ansi.sys keeps a lookout for
  25.     the escape character (chr(27), known as ESC); this character signals
  26.     the start of a terminal control sequence.
  27.     Terminal control sequences follow the format
  28.         ESC [ param; param; ...; param cmd
  29.     where
  30.         ESC    is the escape character chr$(27).
  31.         [    is the left bracket character.
  32.         param    is an ASCII decimal number, or a string in quotes.
  33.         cmd    is a case-specific letter identifying the command.
  34.     Usually, zero, one, or two parameters are given.  If parameters
  35.     are omitted, they usually default to 1; however, some commands
  36.     (KKR and DKOCT) treat the no-parameter case specially.
  37.     Spaces are not allowed between parameters.
  38.  
  39.     For example, both ESC[1;1H and ESC[H send the cursor to the home
  40.     position (1,1), which is the upper left.
  41.  
  42.     Either single or double quotes may be used to quote a string.
  43.     Each character inside a quoted string is equivalent to one numeric
  44.     parameter.  Quoted strings are normally used only for the Keyboard
  45.     Key Reassignment command.
  46.  
  47. Control Sequences
  48.     The following table lists the sequences understood by nansi.sys.
  49.     Differences between nansi.sys and the standard ansi.sys are marked
  50.     with a vertical bar (|).
  51.  
  52. Cursor Positioning
  53. Short    Long name        Format        Notes
  54. CUP    cursor position        ESC[y;xH    Sets cursor position.
  55. HVP    cursor position        ESC[y;xf    Same as CUP; not recommended.
  56. CUU    cursor up        ESC[nA        n = # of lines to move
  57. CUD    cursor down        ESC[nB
  58. CUF    cursor forward        ESC[nC        n = # of columns to move
  59. CUB    cursor backward        ESC[nD
  60. DSR    Device Status, Report!    ESC[6n        Find out cursor position.
  61. CPR    Cursor Position report    ESC[y;xR    Response to DSR, as if typed.
  62. SCP    Save Cursor Position    ESC[s        Not nestable.
  63. RCP    Restore Cursor Position ESC[u
  64.  
  65. Editing
  66. ED    Erase in Display    ESC[2J    Clears screen.
  67. EL    Erase in Line        ESC[K    Clears to end of line.
  68. IL  |    Insert Lines        ESC[nL    Inserts n blank lines at cursor line.
  69. DL  |    Delete Lines        ESC[nM    Deletes n lines including cursor line.
  70. ICH |    Insert Characters    ESC[n@    Inserts n blank chars at cursor.
  71. DCH |    Delete Characters    ESC[nP    Deletes n chars including cursor char.
  72.  
  73.  
  74. Mode-Setting
  75. SGR    Set Graphics Rendition    ESC[n;n;...nm    See character attribute table.
  76. SM    Set Mode        ESC[=nh        See screen mode table.
  77. RM    Reset Mode        ESC[=nl        See screen mode table.
  78. IBMKKR    Keyboard Key Reass.    ESC["string"p
  79.     The first char of the string gives the key to redefine; the rest
  80.     of the string is the key's new value.
  81.     To specify unprintable chars, give the ASCII value of the char
  82.     outside of quotes, as a normal parameter.
  83.     IBM function keys are two byte strings; see the IBM Basic manual.
  84.     For instance, ESC[0;";dir a:";13;p redefines function key 1 to
  85.     have the value "dir a:" followed by the ENTER key.
  86.       | If no parameters given, all keys are reset to their default values.
  87.  
  88. DKOCT | Output char translate    ESC[n;ny
  89.       | When first char is encountered in output request, it is replaced with
  90.       | the second char.  This might be useful for previewing text before
  91.       | sending it to a printer with a funny print wheel.
  92.       | If no parameters are given, all chars are reset to normal.
  93.  
  94.  
  95. Character Attributes
  96.     The Set Graphics Rendition command is used to select foreground
  97.     and background colors or attributes.
  98.     When you use multiple parameters, they are executed in sequence, and
  99.     the effects are cumulative.
  100.        Attrib code        Value
  101.         0        All attributes off (normal white on black)
  102.         1        Bold
  103.         4        Underline
  104.         5        Blink
  105.         7        Reverse Video
  106.         8        Invisible (but why?)
  107.         30-37        foregnd blk/red/grn/yel/blu/magenta/cyan/white
  108.         40-47        background
  109.  
  110. Screen Modes
  111.     The IBM BIOS supports several video modes; the codes given in the
  112.     BIOS documentation are used as parameters to the Set Mode command.
  113.       | (In bitmap modes, the cursor is simulated with a small blob (^V).)
  114.         Mode Code        Value
  115.         0        text 40x25 Black & White
  116.         1        text 40x25 Color
  117.         2        text 80x25 Black & White
  118.         3        text 80x25 Color
  119.         4        bitmap 320x200 4 bits/pixel
  120.         5        bitmap 320x200 1 bit/pixel
  121.         6        bitmap 640x200 1 bit/pixel
  122.         7        (cursor wrap kludge)
  123.         13 (EGA)    bitmap 320x200 4 bits/pixel ?
  124.         14 (EGA)    bitmap 640x200 4 bits/pixel
  125.         16 (EGA)    bitmap 640x350 4 bits/pixel
  126.     Mode 7 is an unfortunate kludge; Setting mode 7 tells the cursor
  127.     to wrap around to the next line when it passes the end of a line;
  128.     Resetting mode 7 tells the cursor to not wrap, but rather stay put.
  129.       | If your computer has the Enhanced Graphics Adaptor, modes between
  130.       | 8 and 15 are also supported; see the EGA BIOS for info.
  131.       | The EGA also lets you use a shorter character cell in text modes
  132.       | in order to squeeze 43 lines of text out of the 25-line text modes.
  133.       | To enter 43 line mode, set the desired 25-line text mode (0 to 3),
  134.       | then Set Mode 43.  For instance: ESC[=3h ESC[=43h.
  135.       | To exit 43 line mode, set the desired 25-line text mode again.
  136.       | Nansi.sys ignores mode 43 unless there is an EGA on your computer.
  137.  
  138. Faster Output
  139.       | Any program that sets the console to RAW mode, and buffers its
  140.       | output properly, can achieve extremely high screen update speeds in
  141.       | return for giving up the special functions of the keys ^C, ^S, and ^P.
  142.       | See IOCTL in the MS-DOS 3.x Technical Reference for more info.
  143.     Also, a small improvement in speed may be noticed with some
  144.     programs that use the DOS console in normal mode, as this driver
  145.     efficiently implements the (standard but undocumented) INT 29h
  146.     most-favored-device putchar used by DOS.
  147.  
  148. BUGS
  149.     Insert and delete character do not work in graphics modes.
  150.     Graphics mode writing is slow.
  151.     The simulated cursor in graphics mode slows down single-char
  152.     writes by a factor of 3; it should be disable-able.
  153.     Does not support erase-to-end-of-screen and other useful functions.
  154.  
  155. Version
  156.     This version, 2.2, created February 1986.  Problems should
  157.     be reported to Daniel Kegel, 1-60 CIT, Pasadena, CA 91126
  158.     (or, after June 1986, 2648 169th Ave SE, Bellevue, Wa. 98008).
  159.     Your suggestions for improvement would be most welcome.
  160.  
  161. NOTE
  162.     This program may be distributed for educational and personal use
  163.     only.  Commercial use is verboten; get in touch with the author.
  164.